﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ModelLayer.Appointments
{
    public class VisitModelView
    {
        private Guid patientOID;

        public Guid PatientOID
        {
            get { return patientOID; }
            set { patientOID = value; }
        }

        private string mrnID;

        public string MrnID
        {
            get { return mrnID; }
            set { mrnID = value; }
        }

        private string status;

        public string Status
        {
            get { return status; }
            set { status = value; }
        }

        private string accessionNumber;

        public string AccessionNumber
        {
            get { return accessionNumber; }
            set { accessionNumber = value; }
        }

        private string familyName;

        public string FamilyName
        {
            get { return familyName; }
            set { familyName = value; }
        }

        private string middleName;

        public string MiddleName
        {
            get { return middleName; }
            set { middleName = value; }
        }

        private string givenName;

        public string GivenName
        {
            get { return givenName; }
            set { givenName = value; }
        }

        private string procedureTypeName;

        public string ProcedureTypeName
        {
            get { return procedureTypeName; }
            set { procedureTypeName = value; }
        }

        private string priority;

        public string Priority
        {
            get { return priority; }
            set { priority = value; }
        }

        private DateTime admitTime;

        public DateTime AdmitTime
        {
            get { return admitTime; }
            set { admitTime = value; }
        }

        private DateTime dischargeTime;

        public DateTime DischargeTime
        {
            get { return dischargeTime; }
            set { dischargeTime = value; }
        }

        private string studyName;

        public string StudyName
        {
            get { return studyName; }
            set { studyName = value; }
        }

        private string practitionerName;

        public string PractitionerName
        {
            get { return practitionerName; }
            set { practitionerName = value; }
        }

        private string reasonForStudy;

        public string ReasonForStudy
        {
            get { return reasonForStudy; }
            set { reasonForStudy = value; }
        }

        private DateTime dateOfBirth;

        public DateTime DateOfBirth
        {
            get { return dateOfBirth; }
            set { dateOfBirth = value; }
        }

        private string telephone;

        public string Telephone
        {
            get { return telephone; }
            set { telephone = value; }
        }

        private string mobileNumber;

        public string MobileNumber
        {
            get { return mobileNumber; }
            set { mobileNumber = value; }
        }

        private string patientType;

        public string PatientType
        {
            get { return patientType; }
            set { patientType = value; }
        }

        private string email;

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        private string sex;

        public string Sex
        {
            get { return sex; }
            set { sex = value; }
        }

        private string idDocumentNumber;

        public string IdDocumentNumber
        {
            get { return idDocumentNumber; }
            set { idDocumentNumber = value; }
        }

        private bool isAppointment;

        public bool IsAppointment
        {
            get { return isAppointment; }
            set { isAppointment = value; }
        }

        private bool vipIndicator;

        public bool VipIndicator
        {
            get { return vipIndicator; }
            set { vipIndicator = value; }
        }

        public static List<VisitModelView> FillAppointments(DataTable table)
        {
            List<VisitModelView> visitArray = new List<VisitModelView>();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                VisitModelView visitView = new VisitModelView();
                visitView.PatientOID = Guid.Parse(table.Rows[i].ItemArray[0].ToString());
                visitView.AccessionNumber = table.Rows[i].ItemArray[1].ToString();
                visitView.Status = table.Rows[i].ItemArray[2].ToString();
                visitView.FamilyName = table.Rows[i].ItemArray[3].ToString();
                visitView.MrnID = table.Rows[i].ItemArray[4].ToString();
                visitView.MiddleName = table.Rows[i].ItemArray[5].ToString();
                visitView.GivenName = table.Rows[i].ItemArray[6].ToString();
                visitView.ProcedureTypeName = table.Rows[i].ItemArray[7].ToString();
                visitView.Priority = table.Rows[i].ItemArray[8].ToString();
                visitView.AdmitTime = DateTime.Parse(table.Rows[i].ItemArray[9].ToString());
                visitView.DischargeTime = DateTime.Parse(table.Rows[i].ItemArray[10].ToString());
                visitView.StudyName = table.Rows[i].ItemArray[11].ToString();
                visitView.PractitionerName = table.Rows[i].ItemArray[12].ToString();
                visitView.ReasonForStudy = table.Rows[i].ItemArray[13].ToString();
                visitView.DateOfBirth = DateTime.Parse(table.Rows[i].ItemArray[14].ToString());
                visitView.Telephone = table.Rows[i].ItemArray[15].ToString();
                //visitView.AdmissionType = table.Rows[i].ItemArray[16].ToString();
                visitArray.Add(visitView);
            }
            return visitArray;
        }
    }
}
